#!/usr/bin/env python

import rospy
import os
from task_planner.msg import Environment

def talker():
	os.system("clear") 
	rospy.init_node('talker', anonymous=True)

	pub = rospy.Publisher('environment', Environment, queue_size=10)

	env = Environment()
	env.p_LightON  = False
	env.p_BlindsON = False
	env.p_AutoMode = True
	env.p_Presence = True
	env.p_SunLight = False
	env.p_LightButton  = False
	env.p_BlindsButton = False

	pub.publish(env)

	ok = 0
	rate = rospy.Rate(1) # 1hz
	while not rospy.is_shutdown():
		if ok == 7:
			env.p_BlindsButton = True
			pub.publish(env)
			print "BlindsButton: TRUE "

		if ok == 14:
			env.p_Presence = False
			pub.publish(env)
			print "Presence: FALSE "

		rospy.loginfo("talker")		
		rate.sleep()
		ok += 1

if __name__ == '__main__':
	try:
		talker()
	except rospy.ROSInterruptException:
		pass
